<template>
	<div class="unit">
		<HyForm :hyFormConfig="hyFormConfig" :hyFormFields="hyFormFields" ref="hyFormRef" />
		<div class="flex justify-center">
			<el-button type="primary" :loading="loading" @click="submit(hyFormRef)">确认</el-button>
		</div>
	</div>
</template>

<script lang="ts" setup>
import HyForm from '/@/components/HyForm/index.vue';
import { toRefs, defineProps, ref } from 'vue';
const loading = ref(false);
const hyFormRef: any = ref(null);
const props = defineProps({
	message: {
		type: Object,
		default: () => {
			return {};
		},
	},
});

const submit = (formEl: any) => {
	if (!formEl) return;
	formEl.validate((valid: any, fields: any) => {
		if (valid) {
			// console.log('参数', hyFormRef.value.hyForm);
			// let parms = {
			// 	processInstanceId: props.flowData.processInstanceId,
			// 	taskId: props.flowData.taskId,
			// 	nodeId: props.flowData.nodeId,
			// 	appCode: props.flowData.appCode,
			// 	pass: hyFormRef.value.hyForm.pass == 'true' ? true : false,
			// 	advice: hyFormRef.value.hyForm.advice,
			// 	files: hyFormRef.value.hyForm.files,
			// };
		}
	});
};

//配置基本信息表单
const hyFormFields = computed(() => {
	return {
		pass: {
			label: '意见上传',
			type: 'upload',
			required: true,
		},
		pass1: {
			label: '备注',
			type: 'textarea',
			required: true,
		},
	};
});
//动态表单配置
const hyFormConfig = computed(() => {
	return {
		labelWidth: '100px',
		span: 24,
		offset: 0,
		type: 'submit',
	};
});

const { message } = toRefs(props);
</script>

<style lang="scss" scoped>
.unit {
	background-color: #fff;
}
:deep(.el-descriptions__label) {
	width: 15% !important;
}
</style>
